{literal}
<script>

                           $(document).ready(function()
                                  {

          var options = {
              target:        '#admin',   // target element(s) to be updated with server response.
//              beforeSubmit:  validate,  // pre-submit callback.
                };

       $('#admin_add,#admin_edit').submit(function() {
      $(this).ajaxSubmit(options);
      return false;
      });
       
       $("#add,#del").click( function() {
    	   $( this ).ajaxComplete(function(){

    	   	page('','admins');

    	   	});
    	   });

   });
function deladmin( login )
{
$.ajax({
type: "POST",
data: "login=" + login + "&del=1"  ,
url: "index.php?type=admins"
        });
        }



</script>
{/literal}
<div id="admins">
<form  id="{if $smarty.get.admin == 'new'}admin_add{else}admin_edit{/if}" action="index.php?type=admin&admin={$smarty.get.admin}" method="POST">
<table>
<tr class="menu">
<td>Логін</td> <td>Параметри користувача</td><td>Пароль користувача</td><td>Статистика користувача</td><td>Гроші користувача</td><td>Видалять добавлять</td> <td>Тарифи</td><td>root</td> <td>Пароль(пусто - без змін)</td> <td>Видалити</td> <td>Змінити</td>
</tr>


<tr>


<td>
{if $smarty.get.admin == 'new'}
<input type="text" name="login">
{else}
{if $smarty.session.login == $admin.login }<b><font color="red"> {$admin.login}</font></b>{else}{$admin.login}{/if}
{/if}
</td>

<td>
<input type="checkbox" {if $smarty.session.login == $admin.login }disabled {/if} {if $admin.ChgConf ==1 }CHECKED{/if} name="admin[ChgConf]" value="1">
</td>
<td>
<input type="checkbox" {if $smarty.session.login == $admin.login }disabled {/if} {if $admin.ChgPassword ==1 }CHECKED{/if} name="admin[ChgPassword]" value="1">
</td>
<td>
<input type="checkbox" {if $smarty.session.login == $admin.login }disabled {/if} {if $admin.ChgStat ==1 }CHECKED{/if} name="admin[ChgStat]" value="1">
</td>
<td>
<input type="checkbox" {if $smarty.session.login == $admin.login }disabled {/if} {if $admin.ChgCash ==1 }CHECKED{/if} name="admin[ChgCash]" value="1">
</td>
<td>
<input type="checkbox" {if $smarty.session.login == $admin.login }disabled {/if} {if $admin.UsrAddDel ==1 }CHECKED{/if} name="admin[UsrAddDel]" value="1">
</td>
<td>
<input type="checkbox" {if $smarty.session.login == $admin.login }disabled {/if} {if $admin.ChgTariff ==1 }CHECKED{/if} name="admin[ChgTariff]" value="1">
</td>

<td>
<input type="checkbox" {if $smarty.session.login == $admin.login }disabled {/if} {if $admin.ChgAdmin ==1 }CHECKED{/if} name="admin[ChgAdmin]" value="1">
</td>


<td>
{if $smarty.session.login != $admin.login }
<input size="5"  type="text" name="password" value="">
{/if}
</td>

<td>
{if $smarty.get.admin != 'new'}
{if $smarty.session.login != $admin.login }
<button style="color:red;font-weight:bold" id="del" class="button"  OnClick="{literal}if(confirm('Та ну нах, може не треба?')){ deladmin('{/literal}{$admin.login}{literal}') }else {return false;}{/literal}" >Видалити</button>
{/if}
{/if}
</td>

<td>
{if $smarty.session.login != $admin.login }
{if $smarty.get.admin == 'new'}


<input type="hidden" name="add" value="1">
<input class="button" id="add" type="submit" value="Додати">
{else}
<input type="hidden" name="login" value="{$admin.login}">
<input type="hidden" name="edit" value="1">
<input class="button" type="submit" value="Змінити">
{/if}
{/if}
</td>


</tr>
</table>
</form>


</div>



